package com.example.bgmachine.bgmachine.exts;

import com.example.bgmachine.bgmachine.homes.MerilData;

import java.util.HashMap;

public class DevicesInfors {

    static DevicesInfors mDevicesInfors = null;

    public int device_type = 1;

    public int weighing_verification_status = 0;

    private HashMap<String, String> mVerifyTime = new HashMap<String, String>();


    public DevicesInfors() {


    }

    static public DevicesInfors getDevicesInfors() {
        if (mDevicesInfors == null) {
            mDevicesInfors = new DevicesInfors();
        }

        return mDevicesInfors;
    }

    public int getDevice_type() {
        return device_type;
    }

    public int getWeighing_verification_status() {
        return weighing_verification_status;
    }

    public void setDevice_type(int device_type) {
        this.device_type = device_type;
    }

    public void setWeighing_verification_status(int weighing_verification_status) {
        this.weighing_verification_status = weighing_verification_status;
    }

    public void setmVerifyTime(String itema, String itemb ){
        this.mVerifyTime.put(itema,itemb);
    }

    public boolean jusitVerifyTime( String items ){
        String itema = items;
        itema = itema.replace(":","");
        itema = itema.replace(" ","");

        boolean statusa = false;
        int numta = Integer.parseInt( itema );
        for (String kyes : mVerifyTime.keySet()) {
            String infora = kyes;
            String inforb = mVerifyTime.get(kyes);
            infora = infora.replace(":","");
            infora = infora.replace(" ","");
            inforb = inforb.replace(":","");
            inforb = inforb.replace(" ","");
            int numca = Integer.parseInt( infora );
            int numcb = Integer.parseInt( inforb );
            if(numca <= numta && numta <=  numcb){
                return true;
            }
        }
        return statusa;
    }
}
